
{{extend ('./layout.html')}}

{{#block ("body")}}

<div class="main-container">
	<div class="padding-md">
		<ul class="breadcrumb">
			<li><span class="primary-font"><i class="icon-home"></i></span><a href="/"> Home</a></li>
			<li>信息反馈列表</li>
		</ul>
		<table class="table table-striped" id="dataTable">
			<thead>
			<tr>
				<th>通知ID</th>
		
				<th>通知内容</th>
				<th>发布老师</th>
				<th>反馈学生</th>
				<th>发布班级</th>
				<th>时间</th>
				<th>操作</th>
			</tr>
			</thead>
			<tbody>
			{{#each(mes)}}


			<tr>
				<td>{{this.message_id}}</td>
				<td>{{this.message_content}}</td>
				<td>{{this.teach_name}}</td>
				<td>{{this.stu_name}}</td>
				<td>{{this.class_name}}</td>
				<td class="data_time" data-time="{{this.message_time}}"></td>
				
				<td>
					<a href="/message/message_edite/{{this.message_id}}">编辑</a>
					<a onclick="return confirm('是否确认删除','注意：删除班级会删除班级里所有的学生')" href="/message/message_delete/{{this.message_id}}">删除</a>
				</td>
			</tr>
			{{/each}}


			</tbody>
		</table>

		{{include ("./common/message_page.html")}}

	</div><!-- ./padding-md -->
</div><!-- /main-container -->

{{/block}}

<!-- 转换时间格式 -->
<script>
	$(document).ready(function(){

	    var data_time = $(".data_time");

        data_time.each(function(item){

            var date = timestampToTime(this.dataset.time);
            this.innerHTML = "";
            this.innerHTML = date;
        });

        function timestampToTime(timestamp) {
            var date = new Date(timestamp * 1000);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
            Y = date.getFullYear() + '-';
            M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
            D = date.getDate() + ' ';
            h = date.getHours() + ':';
            m = date.getMinutes();
            return Y+M+D+h+m;
        }
	});
</script>